package com.lmk.ms.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.lmk.ms.common.constants.DbDelFlagEnum;
import com.lmk.ms.common.constants.DbStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 带有修改记录的 主键的实体类
 *
 * @author laomake@hotmail.com
 * @version 1.0
 * @date 2021/07/12
 */
@Schema(description = "带有修改记录的有主键的实体类")
public abstract class RecordEntity<PK extends Serializable> extends PkEntity<PK> {

    @Schema(description = "状态：0.停用，1.启用")
    private DbStatusEnum status;

    /**
     * 删除状态：1.删除，0.正常
     */
    @TableLogic
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "删除状态：1.删除，0.正常")
    protected DbDelFlagEnum delFlag;

    /**
     * 创建人
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "创建人")
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    protected String createBy;

    /**
     * 创建时间
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    protected LocalDateTime createTime;

    /**
     * 修改人
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "修改人")
    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    protected String updateBy;

    /**
     * 修改时间
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "修改时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    protected LocalDateTime updateTime;

    /**
     * 删除人
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "删除人")
    @TableField(exist = false)
    protected String deleteBy;

    /**
     * 删除时间
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false)
    @Schema(description = "删除时间")
    protected LocalDateTime deleteTime;

    /**
     * 备注
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @Schema(description = "备注")
    protected String remark;

    public DbStatusEnum getStatus() {
        return status;
    }

    public void setStatus(DbStatusEnum status) {
        this.status = status;
    }

    public DbDelFlagEnum getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(DbDelFlagEnum delFlag) {
        this.delFlag = delFlag;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getDeleteBy() {
        return deleteBy;
    }

    public void setDeleteBy(String deleteBy) {
        this.deleteBy = deleteBy;
    }

    public LocalDateTime getDeleteTime() {
        return deleteTime;
    }

    public void setDeleteTime(LocalDateTime deleteTime) {
        this.deleteTime = deleteTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
